# http://doc.qt.nokia.com/4.7/qmake-variable-reference.html
# http://doc.qt.nokia.com/4.7/qmake-function-reference.html
#-------------------------------------------------------------
# Configuration
#-------------------------------------------------------------
# Enable project to be built in both modes,
CONFIG      += qt warn_on debug_and_release
CONFIG      += dll
DEFINES     += QEXTSERIALPORT_LIB
#CONFIG     += staticlib

# event driven device enumeration on windows requires the gui module
!win32:QT   -= gui

PROJECT     = qextserialport

#-------------------------------------------------------------
# Name of the target (modified depending on the building mode)
#-------------------------------------------------------------
# Modify target name according when building in debug mode
TARGET_DEBUG_SUFFIX = d
CONFIG(debug, debug|release) {
    TARGET_DEBUG_SUFFIX = d
} else {
    TARGET_DEBUG_SUFFIX =
}

TARGET      = qextserialport$$TARGET_DEBUG_SUFFIX


#-------------------------------------------------------------
# Version is used as a suffix to the target's name
# but on win32 only the major version is appended to the
# target's name
#-------------------------------------------------------------
#VERSION     = 1.2.0


#-------------------------------------------------------------
# The template here is just a lib
#-------------------------------------------------------------
TEMPLATE    = lib


#-------------------------------------------------------------
# Specifies where to put the target file(s) - platform dependant
# todo : We could also make this architecture
# (x86, ppc, x86_64, ...) dependant
#-------------------------------------------------------------
macx {
    PLATFORM = mac
}
unix: !macx {
    PLATFORM = linux
}
win32 {
    PLATFORM = windows
}
DESTDIR     = build/$$PLATFORM
OBJECTS_DIR = build/$$PLATFORM/tmp
MOC_DIR     = build/$$PLATFORM/tmp
UI_DIR      = build/$$PLATFORM/tmp
RCC_DIR     = build/$$PLATFORM/tmp


#-------------------------------------------------------------
# Sources
#-------------------------------------------------------------
# todo : use precompiled header when possible
HEADERS     = qextserialport.h \
              qextserialenumerator.h \
              qextserialport_global.h

SOURCES     = qextserialport.cpp

unix:SOURCES        += posix_qextserialport.cpp
unix:!macx:SOURCES  += qextserialenumerator_unix.cpp
macx {
    SOURCES         += qextserialenumerator_osx.cpp
    LIBS            += -framework IOKit -framework CoreFoundation
}

win32 {
    SOURCES         += win_qextserialport.cpp qextserialenumerator_win.cpp
    DEFINES         += WINVER=0x0501 # needed for mingw to pull in appropriate dbt business...probably a better way to do this
    LIBS            += -lsetupapi -lAdvapi32 -lUser32
}
